<import file="block/common.html" name="url"/>
<div class="layui-fluid">
    <div class="layui-form">
		<div class="layui-form-item">
            <label class="layui-form-label required">角色名</label>
            <div class="layui-input-inline">
                <input type="text" name="groupname" lay-verify="required" lay-reqtext="角色名不能为空" placeholder="请输入角色名" value="<{$info['groupname']}>" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">一般 为中文 如：XX部</div>
        </div>
		
        <div class="layui-form-item">
            <div class="layui-input-block">
			<input type="hidden" name="id" value="<{$info['id']}>">
                <button class="layui-btn" lay-submit lay-filter="saveBtn"><?php echo lang('save');?></button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        form.render();

        //监听提交
        form.on('submit(saveBtn)', function (data) {
			$.post('<{caUrl("admingroup","edit")}>',data.field,function(res){
                if(res.status == 1){
                    layer.msg(res.info, {icon: 1, time: 1000},function(){
						loadMain('<{caUrl("admingroup","index")}>');
					});
                }else{
                    layer.msg(res.info, {icon: 2, anim: 6, time: 5000});
                }
            });
            return false;
        });

    });
</script>